from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from webdriver_manager.chrome import ChromeDriverManager

# 1. 打开浏览器驱动管理
ChromeIns = ChromeDriverManager().install()
# 2. 创建谷歌浏览器驱动对象
driver = webdriver.Chrome(service=Service(ChromeIns))
# 3. 进入百度网址
driver.get('https://www.baidu.com')
# 4. 查找元素
search_boxs = driver.find_elements(By.CSS_SELECTOR, '#hotsearch-content-wrapper > li')
search_box1 = driver.find_element(By.CSS_SELECTOR, '#kw')
search_box2 = driver.find_element(By.XPATH,'//*')
# 5. 关闭浏览器
driver.quit()
